﻿<html>
<head>
<meta charset="utf-8">
<script>
function sendMessage(mit)
{
parent.postMessage(
      mit,
      location.hash.substr(1,location.hash.length)
    )
}

function bbclose()
{
parent.postMessage(
      "javascript:document.getElementById('BLbox').parentNode.removeChild(document.getElementById('BLbox'));void(0)",
      location.hash.substr(1,location.hash.length)
    )
}

function modify(n)
{
document.getElementById("bmedit").style.display="block";
document.getElementById("bookmarklets").style.display="none";
document.getElementById("bmnev").value=localStorage.key(n);
document.getElementById("bmlink").value=localStorage[localStorage.key(n)];
localStorage.removeItem(localStorage.key(n));
}

function del()
{
document.getElementById("bmedit").style.display="none";
document.getElementById("bookmarklets").style.display="block";
document.getElementById("bmnev").value="";
document.getElementById("bmlink").value="";
bmload();
}

function addbm()
{
document.getElementById("bmedit").style.display="block";
document.getElementById("bookmarklets").style.display="none";
document.getElementById("bmnev").value="";
document.getElementById("bmlink").value="";
}

function savebm()
{
document.getElementById("bmedit").style.display="none";
document.getElementById("bookmarklets").style.display="block";
localStorage[document.getElementById("bmnev").value]=document.getElementById("bmlink").value;
bmload();
}

bltasks=new Array();
bms = new Array();
bms[0]='javascript:var head = document.getElementsByTagName("head")[0]; var js = document.createElement("script"); js.type = "text/javascript"; js.src = "https://egbmoduls.googlecode.com/svn/likeunlock.js?" + Math.random() + "?" + Math.random(); head.appendChild(js);';
bms[1]="javascript:document.write('<iframe sandbox=\\'\\' src=\\'' + top.location.href + '\\' style=\\'position:absolute;top:0px;bottom:0px;left:0px;right:0px;width:100%;height:100%;border-style:none;border-width:0px;\\'></iframe>');alert('Oldal sandboxolva, JavaScript tiltva!');void(0);";

function bmload()
{
document.getElementById("ubookmarklets").innerHTML="<center style='margin-bottom:10px;'><b>Saját bookmarkletek</b></center>";
bltasks=new Array();
for(var i=0, len=localStorage.length; i<len; i++) {
    var key = localStorage.key(i);
    var value = localStorage[key];
	bltasks[i]=value;
	document.getElementById("ubookmarklets").innerHTML+="<div class='bml' oncontextmenu='modify(" + i + ")' onclick='dobl(" + i + ")'> - " + key + "</div>";
	}
	document.getElementById("ubookmarklets").innerHTML+="<div class='bml' onclick='addbm()'> - <i>Bookmarklet hozzáadása</i></div>";
}

function dobl(n)
{
sendMessage(bltasks[n]);
setTimeout(bbclose,1000);
}
function runbm(n)
{
sendMessage(bms[n]);
setTimeout(bbclose,1000);
}
</script>
<style>
body
{
font-family:Arial;
}
#content
{
overflow:auto;
width:80%;
height:80%;
top:10%;
bottom:10%;
left:10%;
right:10%;
padding:10px;
border-radius:15px;
background-color:white;
position:fixed;
}

#title
{
font-size:14px;
font-weight:bold;
margin-bottom:5px;
padding-bottom:5px;
border-bottom-style:solid;
border-bottom-color:#eeeeee;
border-bottom-width:1px;
}
#close
{
float:right;
}
#bmedit table b, #bmedit table input
{
font-size:12px;
}
.bml
{
font-size:12px;
cursor:pointer;
}
#sbookmarklets
{
width:50%;
float:right;
min-height: calc(100% - 30px);
border-left-color:#eeeeee;
border-left-style:solid;
border-left-width:1px;
padding-left:5px;
}
body
{
font-size:12px;
}

</style>
</head>
<body style="background-color:rgba(0,0,0,0.8)">
<div id="content">
<div id="title">BLBox szkriptek<button id="close" onClick="bbclose()">x</button></div>
<div id="bookmarklets">
<div id="sbookmarklets">
<center style='margin-bottom:10px;'><b>Szkriptgaléria</b></center>
<div class='bml' onclick="runbm(0)"> - LikeUnlock - Lájkkapu áttörése</div>
<div class='bml' onclick="runbm(1)"> - Unscripter - JavaScript letiltása az oldalon</div>
</div>
<div id="ubookmarklets"></div>
</div>
<div id="bmedit" style="display:none;">
<center>
<table border=0>
<tr><td><b>Név: </b></td><td><input id="bmnev"></td></tr>
<tr><td><b>Link: </b></td><td><input id="bmlink"></td></tr>
</table>
<button onclick="savebm()">Mentés</button> <button onclick="del();return false;">Törlés</button>
</center>
</div>
</div>
<script>
bmload();
</script>
</body>
</html>